/**
 * @author KujoMiva
 * @name Router.ts
 * @desc 
 * @time 2020年02月08日 18:50:16 星期六
 */
class Router extends egret.DisplayObjectContainer {
  public constructor() {
    super()
    this.once(egret.Event.ADDED_TO_STAGE, this.init, this)
  }

  private init() {
    // this.addChild(new CheckText())
    // this.addChild(new CheckMap())
    this.addChild(new Loading())
    // this.addChild(new CYS())
    this.runStaion()
  }

  private runStaion() {

    this.stage.addEventListener('gotoCheckMap', () => {
      const screenItem = new CheckMap()
      screenItem.alpha = 0
      egret.Tween.get(screenItem).to({ alpha: 1 }, 1000)
      this.addChild(screenItem)
    }, this)

    this.stage.addEventListener('gotoCheckText', () => {
      const screenItem = new CheckText()
      screenItem.alpha = 0
      egret.Tween.get(screenItem).to({ alpha: 1 }, 1000)
      this.addChild(screenItem)
    }, this)

    this.stage.addEventListener('gotoCYS', () => {
      const screenItem = new CYS()
      screenItem.alpha = 0
      egret.Tween.get(screenItem).to({ alpha: 1 }, 1000)
      this.addChild(screenItem)
    }, this)

    this.stage.addEventListener('gotoOver', () => {
      const screenItem = new Over()
      screenItem.alpha = 0
      egret.Tween.get(screenItem).to({ alpha: 1 }, 1000)
      this.addChild(screenItem)
    }, this)

    this.stage.addEventListener('gotoLoading', () => {
      this.addChild(new Loading())
    }, this)

  }
}